package com.huawei.fastengine.fastview;

import android.app.Application;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager.NameNotFoundException;
import android.util.Log;
import com.huawei.fastengine.fastview.download.utils.log.FastViewLogUtils;
import com.huawei.fastengine.internal.DistributeType;
import com.huawei.fastengine.internal.FastSdkLoader;
import com.huawei.hms.framework.network.restclient.hwhttp.dns.DnsConfig;
import java.io.IOException;

class FastSDKEngine$1 implements Runnable {
    final /* synthetic */ Application val$application;
    final /* synthetic */ FastSDKEngine$IInitCallback val$initCallback;

    FastSDKEngine$1(Application application, FastSDKEngine$IInitCallback fastSDKEngine$IInitCallback) {
        this.val$application = application;
        this.val$initCallback = fastSDKEngine$IInitCallback;
    }

    public void run() {
        if (FastSDKEngine.access$000(this.val$application)) {
            if (FastSDKEngine.access$400(this.val$application)) {
                Log.i("FastSDKEngine", "initialize SoExit");
                try {
                    FastSdkLoader.init(this.val$application, DistributeType.HostMode, FastSDKEngine.access$100(), FastSDKEngine.access$200());
                    FastSDKEngine.access$300(this.val$application);
                } catch (NameNotFoundException e) {
                    this.val$initCallback.initRes(-1);
                    return;
                } catch (IllegalAccessException e2) {
                    this.val$initCallback.initRes(-1);
                    return;
                } catch (UnsatisfiedLinkError e3) {
                    Log.e("FastSDKEngine", "initialize UnsatisfiedLinkError.");
                    this.val$initCallback.initRes(-1);
                    return;
                }
            }
            Log.i("FastSDKEngine", "initialize So copy");
            try {
                PackageInfo packageInfo = this.val$application.getPackageManager().getPackageInfo(Config.FASTAPP_PACKAGE_NAME, DnsConfig.MAX_CACHE_ENTRIES);
                String str = packageInfo.applicationInfo.nativeLibraryDir;
                FastViewLogUtils.e("FastSDKEngine", "libraryDirold " + str);
                String str2 = this.val$application.getApplicationInfo().dataDir + "/cache/lib";
                FastViewLogUtils.e("FastSDKEngine", "libraryDirnew " + str2);
                FastSDKEngine.access$502(packageInfo.versionCode);
                FastViewLogUtils.e("FastSDKEngine", "copy  copySoVersionCode " + FastSDKEngine.access$500());
                FastSDKEngine.access$600(str, str2);
                FastSdkLoader.init(this.val$application, DistributeType.HostMode, FastSDKEngine.access$100(), FastSDKEngine.access$200());
                FastSDKEngine.access$300(this.val$application);
                if (!FastSDKEngine.access$400(this.val$application)) {
                    this.val$initCallback.initRes(-1);
                    return;
                }
            } catch (IllegalAccessException e4) {
                Log.e("FastSDKEngine", "initialize error:" + e4.toString());
                this.val$initCallback.initRes(-1);
                return;
            } catch (IOException e5) {
                Log.e("FastSDKEngine", "initialize error:" + e5.toString());
                this.val$initCallback.initRes(-1);
                return;
            } catch (NameNotFoundException e6) {
                this.val$initCallback.initRes(-1);
                return;
            } catch (UnsatisfiedLinkError e7) {
                Log.e("FastSDKEngine", "initialize UnsatisfiedLinkError.");
                this.val$initCallback.initRes(-1);
                return;
            }
            Log.i("FastSDKEngine", "initialize INIT_SUC");
            this.val$initCallback.initRes(0);
            return;
        }
        Log.i("FastSDKEngine", "initialize !SystemApp");
        try {
            FastSdkLoader.init(this.val$application, DistributeType.HostMode, FastSDKEngine.access$100(), FastSDKEngine.access$200());
            FastSDKEngine.access$300(this.val$application);
            Log.i("FastSDKEngine", "initialize INIT_SUC getSoInit");
            this.val$initCallback.initRes(0);
        } catch (NameNotFoundException e8) {
            this.val$initCallback.initRes(-1);
        } catch (IllegalAccessException e9) {
            this.val$initCallback.initRes(-1);
        } catch (UnsatisfiedLinkError e10) {
            Log.e("FastSDKEngine", "initialize UnsatisfiedLinkError.");
            this.val$initCallback.initRes(-1);
        }
    }
}
